<?php

namespace App;

use Illuminate\Database\Eloquent\Model;

class Type extends Model {
	protected $fillable = [
		'name',
	];

	public function relation() {
		return $this->hasOne(Relation::class)->select('type_id', 'order_id', 'contacts', 'phone', 'order_time', 'price', 'products', 'receipt_name', 'receipt_address');
	}

	public function orders() {
		return $this->hasMany(Order::class);
	}

	public function activity() {
		return $this->belongsToMany(Activity::class, 'activityables')->withTimestamps()->withPivot('id');
	}
}
